<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/conn.asp"-->
<!--#include file="lib/saferequest.asp"-->

<%
Response.ContentType = "application/json"
'单个查询的例子
'cha=request("cha")
'If cha="tyr" Then sql="select tyr from yb group by tyr"
'If cha="cyr" Then sql="select * from cl"
'If cha="cd" Then sql="select * from cd"
'set rs = Server.CreateObject("ADODB.Recordset")
'QueryToJSON(conn,sql).Flush




tyr=saferequest("q",0)
set rs = Server.CreateObject("ADODB.Recordset")
sql="select top 10 tyr,count(tyr) as num from(select tyr from yb where tyr like '"&tyr&"%') group by tyr"
rs.open sql,conn,1,1
If Not rs.eof Then
	json="{keylist:["
	While Not rs.eof
		json=json&"{'keyname':'"&rs("tyr")&"','keyextend':'"&rs("num")&"'},"
		rs.movenext
	Wend
	json=Left(json,Len(json)-1)&"]}"
	response.write json
Else
	json="false"
	response.write json
End If
rs.close
Set rs=nothing
conn.close
set conn=nothing
%>
